package com.oig.sys.base.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.oig.common.validator.GroupAdd;
import com.oig.common.validator.GroupEdit;
import io.swagger.v3.oas.annotations.media.Schema;

import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import java.util.Date;

@Schema
@Data
public class ParamDto {

    @Schema(description = "编码")
    @NotEmpty(message = "参数错误,编码不能为空", groups={GroupAdd.class, GroupEdit.class})
    @Length(max = 3,min = 3, message = "参数错误,编码3位", groups={GroupAdd.class,GroupEdit.class})
    private String code;

    @Schema(description = "名称", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,名称不能为空", groups={GroupAdd.class,GroupEdit.class})
    private String name;

    @Schema(description = "类型")
    private String type;

    @Schema(description = "参数值", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,参数值不能为空", groups={GroupAdd.class,GroupEdit.class})
    private String value;

    @Schema(description = "说明")
    private String remark;

    @Schema(description = "是否显示 0-否 1-是  默认1", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,名称不能为空", groups={GroupAdd.class,GroupEdit.class})
    private String showFlag;

    @Schema(description = "是否可修改 0-否 1-是 默认1", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,名称不能为空", groups={GroupAdd.class,GroupEdit.class})
    private String modifyFlag;


    @Schema(description = "是否缓存 0-否 1-是 默认0", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,名称不能为空", groups={GroupAdd.class,GroupEdit.class})
    private String cacheFlag;
    @Schema(description = "是否id生成序号 0-否 1-是 为1是每日0点 value值刷新为0 默认0", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotEmpty(message = "参数错误,名称不能为空", groups={GroupAdd.class,GroupEdit.class})
    private String indexFlag;

    @Schema(description = "最后更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    @Schema(description = "最后更新人")
    private String updateUser;


}
